﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TAS.XtOM
{
	public class StandardNodeValueSelector : INodeValueSelector
	{
		private NodeValueSelection selection;

		public StandardNodeValueSelector(NodeValueSelection selection)
		{
			this.selection = selection;
		}

		public string SelectValue(System.Xml.XmlNode node)
		{
			switch (selection)
			{
				case NodeValueSelection.InnerText:
					return node.InnerText;
				case NodeValueSelection.InnerXml:
					return node.InnerXml;
				case NodeValueSelection.OuterXml:
					return node.OuterXml;
				case NodeValueSelection.Value:
					return node.Value;
				default :
					return node.InnerText;
			}
		}
	}

	public enum NodeValueSelection
	{
		InnerText,
		InnerXml,
		OuterXml,
		Value
	}
}
